Skip to content

feat(core): support scoped AI contexts and stateless Test Runner workflows - #3065

Merged
xiong35 merged 10 commits into
mainfrom
fix/test-ai-act-context-history
Sep 4, 2026
Merged

feat(core): support scoped AI contexts and stateless Test Runner workflows#3065
xiong35 merged 10 commits into
mainfrom
fix/test-ai-act-context-history

Conversation

@xiong35

@xiong35 xiong35 commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add default, per-API, and per-call AI context configuration.
  • Resolve contexts using strict override precedence:
    options.context > aiContexts[apiName] > aiContexts.default.
  • Add setAIContext() for updating the default or an API-specific context.
  • Preserve the deprecated aiActContext compatibility APIs.
  • Remove cross-step Test Runner history so workflow steps no longer implicitly receive previous step results.
  • Update unit tests, E2E tests, and bilingual documentation.

Context resolution

Only the highest-priority defined context is used:

  1. Per-call options.context
  2. API-specific aiContexts[apiName]
  3. Shared aiContexts.default

Contexts are not merged automatically.

  • '' explicitly clears lower-priority context.
  • undefined falls back to the next configured level.
  • Users can concatenate context strings explicitly when composition is needed.

The selected context remains raw in task and report data and is wrapped in a generic <CONTEXT> block only when building the LLM input.

Backward compatibility

  • aiActContext and aiActionContext remain available as deprecated aliases for aiContexts.aiAct.
  • setAIActContext() and setAIActionContext() remain available as deprecated aliases for setAIContext('aiAct', context).
  • When both a legacy option and aiContexts.aiAct are provided, aiContexts.aiAct takes precedence.

Test Runner behavior

  • Remove ctx.history, NodeHistoryEntry, workflow history accumulation, and automatic history injection.
  • Workflow steps are now independent and do not implicitly inherit previous step outputs.
  • Shared knowledge can still be provided explicitly through Project context or Agent AI contexts.
  • The internal planning conversation within a single aiAct call remains unchanged.

Validation

  • pnpm run lint
  • pnpm run type-check:tests
  • pnpm exec nx run-many -t build -p @midscene/core @midscene/test --parallel=2
  • pnpm exec nx run-many -t test -p @midscene/core @midscene/shared @midscene/test @midscene/android --parallel=3
  • pnpm --filter @midscene/test exec vitest --run --config vitest.e2e.config.ts

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 31, 2026

Copy link
Copy Markdown

Deploying midscene with  Cloudflare Pages  Cloudflare Pages

Latest commit: bf1ea41
Status: ✅  Deploy successful!
Preview URL: https://ec67973a.midscene.pages.dev
Branch Preview URL: https://fix-test-ai-act-context-hist.midscene.pages.dev

View logs

@xiong35 xiong35 changed the title fix(test): preserve aiActContext when injecting workflow history feat(core): add globalContext support across AI APIs Aug 31, 2026
@xiong35
xiong35 force-pushed the fix/test-ai-act-context-history branch from 08ad708 to f353fae Compare August 31, 2026 07:38
@xiong35 xiong35 changed the title feat(core): add globalContext support across AI APIs feat(core): support default, per-API, and per-call AI contexts Sep 1, 2026
@xiong35
xiong35 force-pushed the fix/test-ai-act-context-history branch from 44fdb31 to e7aa68c Compare September 1, 2026 06:53
@xiong35
xiong35 force-pushed the fix/test-ai-act-context-history branch from e7aa68c to 88c6693 Compare September 2, 2026 09:35
@xiong35
xiong35 force-pushed the fix/test-ai-act-context-history branch from 88c6693 to 9a2880e Compare September 4, 2026 03:57
@xiong35 xiong35 changed the title feat(core): support default, per-API, and per-call AI contexts feat(core): support scoped AI contexts and stateless Test Runner workflows Sep 4, 2026
@xiong35
xiong35 merged commit f0015af into main Sep 4, 2026
17 of 18 checks passed
@xiong35
xiong35 deleted the fix/test-ai-act-context-history branch September 4, 2026 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants